<%--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

        <title>用户管理</title>

        <link href="../../css/mine.css" type="text/css" rel="stylesheet" />
        <script type="text/javascript">
            function tosubmit() {
               document.getElementById("mymethod").value="delete";
                document.forms[1].submit();
            }

            function toexport() {
                document.getElementById("mymethod").value = "export";

                document.forms[1].submit();
            }
        </script>
     </head>
    <body>
        <style>
            .tr_color{background-color: #9F88FF}
        </style>
        <div class="div_head">
            <span>
                <span style="float: left;">当前位置是：系统管理-》用户管理</span>
                <span style="float: right; margin-right: 8px; font-weight: bold;">
                           <span id="export" onclick="toexport()" style="color: blue ;cursor:pointer">
                        【导出】
                    </span>
                    <a style="text-decoration: none;" href="/resource/demo2/getalldepts">【添加】</a>
<%--					<a style="text-decoration: none;" href="#"></a>--%>

                    <span id="deletes" onclick="tosubmit()" style="color: blue ;cursor:pointer">
                        【删除】
                    </span>
                </span>
            </span>
        </div>
        <div></div>
        <div class="div_search">
            <span>
                <form action="/resource/demo2/getemployees" method="post">
                     姓名：
					<input type="text"   name="username" value="${username}"/>
					 角色: 
					<input type="text" name="rname" value="${rname}" />
					 所属部门:
					<input type="text" name="deptname" value="${deptname}"/>
                    <input value="查询" type="submit" />
					
                </form>
            </span>
        </div>

        <div style="font-size: 13px; margin: 10px 5px;">
            <form action="/resource/demo2/deleteByIds" method="post">
                <input type="hidden" name="method" id="mymethod"/>
            <table class="table_a" border="1" width="100%">
                <tbody>
						<tr style="font-weight: bold;">						
                        <td width="40px;">序号</td>
                        <td width="30px;"><input type="checkbox"  /></td>
						<td width="80px;">账号</td>
                        <td width="80px;">姓名</td>
                        <td >角色</td>
						<td width="100px;">所属部门</td>                                        
                        <td align="center" width="100px;">操作</td>
                    </tr>
              <c:forEach var="emp" items="${pageInfo.list}" varStatus="i">
                    <tr id="product1">
                        <td>${i.count}</td>
                        <td><input type="checkbox"  id="empids" name="empids" value="${emp.id}"/></td>
						<td>${emp.loginname}</td>
                        <td><a href="view.jsp">${emp.username}</a></td>
						<td>${emp.role.rname}</td>
						<td>${emp.dept.deptname}</td>
                        <td>
							<a href="/resource/demo2/findEmpbyid?id=${emp.id}">修改</a>
                            <c:if test="${emp.id != sessionScope.employee.id}">
                                <a href="/resource/demo2/deleteById?id=${emp.id}">删除</a>
                            </c:if>
						</td>                        
                    </tr>
              </c:forEach>
                        <c:set var="pages" value="${pageInfo.pages}"/>
                        <c:set var="pageNum" value="${pageInfo.pageNum}"/>
                        <c:set var="prePage" value="${pageInfo.prePage}"/>
                        <c:set var="nextPage" value="${pageInfo.nextPage}"/>
                        <c:set var="total" value="${pageInfo.total}" />
                    <tr>
                        <td colspan="20" style="text-align: center;">
                            <a href="/resource/demo2/getemployees?username=${username}&rname=${rname}&deptname=${deptname}"> 首页 </a>
                            <a href="/resource/demo2/getemployees?index=${prePage==0?1:prePage}&username=${username}&rname=${rname}&deptname=${deptname}"> 上一页 </a>
                            <c:forEach var="i" begin="1" end="${pages}">
                                <c:if test="${i!=pageNum}">
                            <a href="/resource/demo2/getemployees?index=${i}&username=${username}&rname=${rname}&deptname=${deptname}"  style="text-decoration: none" > ${i} </a>
                                </c:if>
                                <c:if test="${i==pageNum}">
                            <a href="/resource/demo2/getemployees?index=${i}&username=${username}&rname=${rname}&deptname=${deptname}"> ${i} </a>
                                </c:if>
                            </c:forEach>
                            <a href="/resource/demo2/getemployees?index=${nextPage==0?pages:nextPage}&username=${username}&rname=${rname}&deptname=${deptname}" onclick="return ${nextPage!=0} "> 下一页 </a>
                            <a href="/resource/demo2/getemployees?index=${pages}&username=${username}&rname=${rname}&deptname=${deptname}"> 尾页 </a>
                         共${total}条   每页显示 ${pageNum}/${pages}
                        </td>
                    </tr>

                </tbody>
            </table>
            </form>
        </div>
    </body>
</html>